/*
//----------------------假接口ts类型定义

//定义全部接口返回数据都有的ts类型
export interface responseData {
    code: number
    message: string
    ok: boolean
}

//与其中一个好友的一条消息的ts类型
 export interface oneFriendOneMessage {
    initiator: string
    message: string
    sendTime: number
}

//发送消息接口携带参数的ts类型
export interface sendMessage extends oneFriendOneMessage {
    friend: string
}

//一个好友聊天界面所有消息的ts类型
export interface showElement {
    friend: string
    chatInfo: string[] | []
    messages: oneFriendOneMessage[] | []
}

//获取所有消息接口返回数据类型
export interface getAllMessageResponseData extends responseData {
    data: showElement[] | []
}

//发送消息接口返回数据类型
export interface sendMessageResponseData extends responseData {
    data: showElement
}
*/
import { userInfo, responseData } from '../user/type'

//每一条聊天信息的ts类型
export interface messages {
    message_id: number
    message_type: string
    media_url?: string | null
    sender_id: number
    message_content: string
    send_time: number
    media?: string | null
    media_size?: string | null
    duration?: number
    preview_url?: string | null
    file_width?: number
    file_height?: number
}

//每个聊天会话的ts类型
export interface conversation {
    conversation_id: number
    users: number[]
    unRead1: number
    unRead2: number
    messages: messages[]
}

//定义服务器返回聊天记录信息的ts类型
export interface chatHistoryResponseData extends responseData {
    data: conversation[]
}

//定义生成对话的数组的ts类型
export interface chatInfo {
    type: string
    message_type?: string
    id: number | string
    content: number | string
    avatar?: string
    media_url?: string | null
    media_size?: string | null
    duration?: number
    preview_url?: string | null
    file_width?: number
    file_height?: number
}

//定义发送http聊天信息的请求体的ts类型
export interface messageFormData {
    message_type: string
    conversation_id: number
    sender_id: number
    receiver_id: number
    message_content: string
    send_time: number
    media?: string | null
    media_name?: string | null
    media_url?: string | null
    media_size?: string | null
    duration?: number
    preview_url?: string | null
    file_width?: number
    file_height?: number
}

//定义处理更新未读消息数量的请求体的ts类型
export interface updateUnReadFormData {
    conversation_id: number
    unRead1?: number
    unRead2?: number
}

//定义一个好友的ts类型
export interface friend {
    userId: number
    username: string
    avatar: string
    realname: string
    conversation_id: number
}

//定义获取用户信息返回数据类型
export interface userInfoResponseData extends responseData {
    data: userInfo
}

//定义服务器返回好友信息的ts类型
export interface userFriendsResponseData extends responseData {
    data: friend[]
}

//定义服务器返回聊天栏所有好友信息的ts类型
export interface chatListFriendsResponseData extends responseData {
    data: friend[]
}

//好友申请项的数据类型
export interface FriendRequireItem {
    friendshipId: number
    status: 'accept' | 'verifying' | 'refuse'
    initiator: number
    friendId: number
    friendAvatar: string
    friendUsername: string
    friendRealname: string
}

//好友申请信息接口响应数据类型
export interface FriendRequireResponseData extends responseData {
    data: FriendRequireItem[]
}

//验证好友申请请求参数类型
export interface VerifyFormData {
    friendshipId: number
    newStatus: 'accept' | 'refuse' | ''
    userId: number
    friendId: number
}

//查找好友请求参数类型
export interface SearchUserFormData {
    userId: number
    searchUsername: string
}

//更改好友聊天页状态(是否可见)的请求参数类型
export interface SetChatStatusFormData {
    conversation_id: number
}

//双方在数据库中的关系状态：是否有关系连接
export interface ContactStatus {
    isContact: boolean
    status: 'accept' | 'verifying' | 'refuse'
    initiator: number
}

//查找好友接口响应数据类型
export interface SearchUserResponseData extends responseData {
    data: {
        userInfo: userInfo
        contactStatus: ContactStatus
    }
}

//发起好友请求请求体的数据类型
export interface ApplyFormData {
    smallId: number
    bigId: number
    initiator: number
    createTime: number
}
